<%@ page contentType="text/html;charset=UTF-8" session="false" %>
<%@ include file="/WEB-INF/common/includes.jsp" %>
<script type="text/javascript">
	$(function() {
		onFormValidate();
	});
	
	function onFormValidate(){
		$('#topicForm').validate({
			rules : {
				title : {
					required : true
				},
				text : {
					minlength : 3,
					required : true
				}
			},
			highlight : function(label) {
				$(label).closest('.control-group').addClass('error');
			},
			success : function(label) {
				$(label).closest('.control-group').addClass('success');
			}
		});
	}
</script>
<div class="control-group">
	<form:label path="title">标题</form:label>
		<form:input path="title" cssClass="input-large" placeholder="标题"  />
		<form:errors path="title" cssClass="text-error" />
		</div>
		<div class="control-group">
	<form:label path="textS">简介</form:label>
		<form:textarea path="textS" placeholder="简介" cssStyle="width:600px; height:400px;" />
		<form:errors path="textS" cssClass="text-error" />
		</div>
<div class="control-group">
	<form:label path="tags">标签</form:label>
		<form:input path="tags" cssClass="input-large" placeholder="标签" />
		<form:errors path="tags" cssClass="text-error" />
</div>
<c:if test="${not empty picId}">
	<div class="control-group">
			<img src="${ctx}/img/${picId}" style="margin-right:10px;" />
	</div>
</c:if>
<div class="control-group">
	<label for="files">封面</label>
	<form:input path="files" type="file" style="width:308px;" />
	<form:errors path="files" />
</div>

<script type="text/javascript" src="${ctx}/res/kindeditor/kindeditor-min.js"></script>

<script>

var editorTextS;
KindEditor.ready(function(K) {
	editorTextS = K.create('textarea[name="textS"]', {
		resizeType : 1,
		allowImageUpload : false,
		allowPreviewEmoticons : false,
		allowFlashUpload : false,
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'link']
	});
});

</script>